﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TransArrange.ascx.cs" Inherits="UserControl_TransArrange" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
<asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource1" OnItemDataBound="DataList1_ItemDataBound" DataKeyField="AllocationID" OnEditCommand="DataList1_EditCommand" OnCancelCommand="DataList1_CancelCommand" OnUpdateCommand="DataList1_UpdateCommand" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1">
    <ItemTemplate>
    <table>
        <tr>
            <td align="left">
                <strong>补货单号:</strong><asp:Label ID="AllocationIDLabel" runat="server" Text='<%# Eval("AllocationID") %>' ForeColor="#FF0000"></asp:Label>    
            </td>
            <td align="left">
                <strong>分店号:</strong><asp:Label ID="StoreIDLabel" runat="server" Text='<%# Eval("StoreID") %>'></asp:Label>
            </td>
            <td align="left">
                <strong>填表日期:</strong><asp:Label ID="AllocationDateLabel" runat="server" Text='<%# Eval("AllocationDate") %>'></asp:Label>
            </td>
        </tr>
        <tr>
            <td  align="left">
                <strong>发运方式:</strong><asp:Label ID="ShipViaLabel" runat="server" Text='<%# Eval("ShipVia") %>'></asp:Label>        
            </td>
            <td align="left">
                <strong>发货日期:</strong><asp:Label ID="ShippedDateLabel" runat="server" Text='<%# Eval("ShippedDate") %>'></asp:Label> 
            </td>
            <td>
            <asp:LinkButton ID="LinkButton1" Text="修改" CommandName="Edit" Runat="Server" /> 
            </td>
            
        </tr>
        <tr>
            <td colspan = "3">
            <ajaxToolkit:CollapsiblePanelExtender ID="cpeDesc" runat="Server"
                        TargetControlID="description_ContentPanel"
                        ExpandControlID="description_HeaderPanel"
                        CollapseControlID="description_HeaderPanel"
                        Collapsed="True"
                        ExpandDirection="Vertical"
                        ImageControlID="description_ToggleImage"
                        ExpandedImage="~/images/collapse.jpg"
                        ExpandedText="折叠"
                        CollapsedImage="~/images/expand.jpg"
                        CollapsedText="展开"
                        SuppressPostBack="true" />                                
    
                <%--Panel 的内容开始--%>
                <asp:Panel ID="description_HeaderPanel" runat="server" style="cursor: pointer;">
                    <div class="collapsePanelHeader" style="background-image: url(Images/bg-menu-main.png); background-repeat: repeat-x">
                        <asp:Image ID="description_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" /> 详细信息
                    </div>
                </asp:Panel>
                
                <asp:Panel id="description_ContentPanel" runat="server" style="overflow:hidden;">
                    <asp:GridView ID="GridView2" runat="server" DataSourceID="ObjectDataSource2" DataKeyNames="AllocationDetailID" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" >
                        <Columns>
                            <asp:BoundField DataField="AllocationDetailID" HeaderText="AllocationDetailID" SortExpression="AllocationDetailID"
                                Visible="False" />
                            <asp:BoundField DataField="ISBN" HeaderText="ISBN" ReadOnly="True" SortExpression="ISBN" />
                            <asp:BoundField DataField="StoreID" HeaderText="分店" ReadOnly="True" SortExpression="StoreID" />
                            <asp:BoundField DataField="Amount" HeaderText="补货量" SortExpression="Amount" />
                        </Columns>
                        <FooterStyle BackColor="Tan" />
                        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="Tan" Font-Bold="True" />
                        <AlternatingRowStyle BackColor="PaleGoldenrod" />            
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DeleteMethod="Destroy"
                        InsertMethod="Insert" SelectMethod="FetchByPKey"
                        TypeName="BookShop.AllocationDetailController" UpdateMethod="Update">
                        <SelectParameters>
                            <asp:Parameter  Name="AllocationID" Type="Object" />
                        </SelectParameters>
                        <SelectParameters>
                            <asp:Parameter  Name="StoreID" Type="Object" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    
                </asp:Panel>
            </td>
        </tr>
    </table>  
    </ItemTemplate>
    <EditItemTemplate>
        <table>
        <tr>
            <td>
            补货单号:<asp:Label ID="AllocationIDLabel" runat="server" Text='<%# Eval("AllocationID") %>'></asp:Label>    
            </td>
            <td>
            分店号:<asp:Label ID="StoreIDLabel" runat="server" Text='<%# Eval("StoreID") %>'></asp:Label>
            </td>
            <td>
            填表日期:<asp:Label ID="AllocationDateLabel" runat="server" Text='<%# Eval("AllocationDate") %>'></asp:Label>
            </td>
        </tr>
        <tr>
            <td >
            发运方式:
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource3" DataTextField="CompanyName" DataValueField="ShipperID">
                </asp:DropDownList>
                <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="FetchAll" TypeName="BookShop.ShipperController"></asp:ObjectDataSource>
            </td>
            <td>
            发货日期:<asp:TextBox ID="TextBox1" runat="server" Width="128px"></asp:TextBox>
                &nbsp;&nbsp;&nbsp;
                <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" CssClass="cssCalendar"
                    TargetControlID="TextBox1">
                </ajaxToolkit:CalendarExtender>
            </td>
            <td>
            <asp:LinkButton ID="LinkButton2" Text="保存" CommandName="update" Runat="Server" /> 
            <asp:LinkButton ID="LinkButton3" Text="返回" CommandName="cancel" Runat="Server" /> 
            </td>
            
        </tr>
        <tr>
            <td colspan = "3">
            <ajaxToolkit:CollapsiblePanelExtender ID="cpeDesc" runat="Server"
                        TargetControlID="description_ContentPanel"
                        ExpandControlID="description_HeaderPanel"
                        CollapseControlID="description_HeaderPanel"
                        Collapsed="True"
                        ExpandDirection="Vertical"
                        ImageControlID="description_ToggleImage"
                        ExpandedImage="~/images/collapse.jpg"
                        ExpandedText="折叠"
                        CollapsedImage="~/images/expand.jpg"
                        CollapsedText="展开"
                        SuppressPostBack="true" />                                
    
                <%--Panel 的内容开始--%>
                <asp:Panel ID="description_HeaderPanel" runat="server" style="cursor: pointer;">
                    <div class="collapsePanelHeader" style="background-image: url(Images/bg-menu-main.png); background-repeat: repeat-x">
                        <asp:Image ID="description_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" /> 详细信息
                    </div>
                </asp:Panel>
                
                <asp:Panel id="description_ContentPanel" runat="server" style="overflow:hidden;">
                    <asp:GridView ID="GridView2" runat="server" DataSourceID="ObjectDataSource2" DataKeyNames="AllocationDetailID" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" >
                        <Columns>
                            <asp:BoundField DataField="AllocationDetailID" HeaderText="AllocationDetailID" SortExpression="AllocationDetailID"
                                Visible="False" />
                            <asp:BoundField DataField="ISBN" HeaderText="ISBN" ReadOnly="True" SortExpression="ISBN" />
                            <asp:BoundField DataField="StoreID" HeaderText="分店" ReadOnly="True" SortExpression="StoreID" />
                            <asp:BoundField DataField="Amount" HeaderText="补货量" SortExpression="Amount" />
                        </Columns>
                        <FooterStyle BackColor="Tan" />
                        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="Tan" Font-Bold="True" />
                        <AlternatingRowStyle BackColor="PaleGoldenrod" />            
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DeleteMethod="Destroy"
                        InsertMethod="Insert" SelectMethod="FetchByPKey"
                        TypeName="BookShop.AllocationDetailController" UpdateMethod="Update">
                        <SelectParameters>
                            <asp:Parameter  Name="AllocationID" Type="Object" />
                        </SelectParameters>
                        <SelectParameters>
                            <asp:Parameter  Name="StoreID" Type="Object" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    
                </asp:Panel>
            </td>
        </tr>
    </table>
    </EditItemTemplate>
    <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
    <SelectedItemStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
    <ItemStyle BackColor="#DEDFDE" ForeColor="Black" />
    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
</asp:DataList>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="FetchAll"
    TypeName="BookShop.AllocationController" UpdateMethod="Update">
    <DeleteParameters>
        <asp:Parameter Name="AllocationID" Type="String" />
        <asp:Parameter Name="StoreID" Type="String" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="AllocationID" Type="String" />
        <asp:Parameter Name="ShippedDate" Type="DateTime" />
        <asp:Parameter Name="ShipVia" Type="String" />
        <asp:Parameter Name="StoreID" Type="String" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="AllocationID" Type="String" />
        <asp:Parameter Name="AllocationDate" Type="DateTime" />
        <asp:Parameter Name="ShippedDate" Type="DateTime" />
        <asp:Parameter Name="ShipVia" Type="String" />
        <asp:Parameter Name="ReceivedDate" Type="DateTime" />
        <asp:Parameter Name="Status" Type="String" />
        <asp:Parameter Name="StoreID" Type="String" />
        <asp:Parameter Name="Principal" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="确定" />